<template>
    <div class="layerRtb layerRtb-threecolumn layerRtb-right">
            <three-title :title="{name:'培训历史'}" :close="false">
        <span tag="i" class="rig_close fr" @click="$parent.$parent.clickFourShow()"></span>
    </three-title>
        <div class="layerRtb-scroll thinScroll" v-scrollHeight="437" v-if="refundUser.length>0">
            <div class="analyItem"  v-for="(item,index) in refundUser" :key="index">
                <p class="analyItemTit tx-center">培训-{{index+1}}</p>
                <div class="analyItemCon">
                  <p class="col-md-6">时间：
                        <span class="cLightGray pr8">{{item.depositCreateTime}}</span>
                  </p>
                  <p class="col-md-6">积分：-
                        <span class="cLightGray pr8">{{item.pmIntegral}}</span>
                  </p>
                    <p class="col-md-12">
                        <span class="cLightGray pr8">{{item.pmDepositRemark}}</span>
                    </p>
                </div>
            </div>
        </div>
        <div class="layerRtb-scroll thinScroll" v-scrollHeight="0" v-else>
                <div class="analyItem">
                    <p class="analyItemTit tx-center">培训</p>
                    <div class="analyItemCon">
                        <p class="col-md-12">
                            <span>暂无内容！</span>
                        </p>
                    </div>
                </div>
        </div>
        <div class="layerRtb-footer">
             <div class="analyItem">
               <p class="analyItemTit tx-center">综合</p>
                   <div class="analyItemCon">
                        <p class="col-md-12">
                            <span>积分-</span>
                            <span>{{compluedTask}}</span>
                        </p>
                    </div>
            </div>
        </div>
    </div>
</template>
<script>
import { mapGetters } from 'vuex'
import { getDepositDetail } from '../../../Resources/Api/index'
export default {
    props: ['IntegralHandle'],
    data () {
        return {
            refundUser: [],
            dateValue: ''
        }
    },
    created () {
        this.GetDeposit()
    },
    methods: {
        GetDeposit () {
            let _this = this
            _this.refundUser = []
            getDepositDetail({
                uId: _this.leftInfo.uid,
                flag: 3, /* 退单 */
                cuurentMonth: this.$utils.format('yyyy-MM', this.dateValue)
            }).then(results => {
                _this.refundUser = results.data.Body
            }).catch(error => {
                console.log(error)
            })
        },
        dataChange () {
            this.GetDeposit()
        },
        clickFourShow (index) {
            this.fourIndex = index
        }
    },
    computed: {
        ...mapGetters(['leftInfo']),
        compluedTask () {
            return this.refundUser.map(item => item.pmIntegral).reduce((acc, cur) => (cur + acc), 0)
        }
    },
    watch: {
        leftInfo () {
            this.GetDeposit()
        }
    }
}
</script>
